<?php
require_once $ubi['SERVER']['SERVER_ROOT'] . '/admin/controller/ctlAbstract.php';

require_once $ubi['SERVER']['SERVER_ROOT'] . '/business/busCategory.php';
require_once $ubi['SERVER']['SERVER_ROOT'] . '/admin/business/busQuestionItem.php';

class ItemController extends AbstractController {
	private $_categoryBus;
	private $_questionItemBus;
	
	public function main(array $getVars) {
		$this->_categoryBus = new CategoryBus();				
		$this->_questionItemBus = new QuestionItemBus();
		
		if ($getVars['type'] == 'review') {
			$arrCatItem1 = $this->_categoryBus->getCategoryItemList(0);
			$catItem1 = $arrCatItem1[0];										
			$arrCatItem2 = $this->_categoryBus->getCategoryItemList($catItem1->getCategoryID());
			
			require_once $ubi_admin['SERVER']['SERVER_ROOT'] . '/view/viewReviewItem.php';
		} else if ($getVars['type'] == 'updateReview') {
			$xml = $_POST['xml'];
			$catID = $_POST['cat'];
			echo $this->_questionItemBus->addQuestionItem($xml, $catID);			
		}		
	}
} 
?>